// pages/shoppingCart/shoppingCart.js
const app = getApp()

Page({
  data: {
    listArr:[]
  },
  onLoad: function () {
    console.log('userId',app.data.userInfo.userid);
    this.chaxun2();
  },
  chaxun2(){
    var that=this;
    wx.request({  
      url: 'https://www.woodymidnight.cn/BCUHelper/api/circle/selectbyuserid',
      method: 'POST',
      data : {
        userId : app.data.userInfo.userid
      },
      header: { 'content-type': 'application/x-www-form-urlencoded' }, 
      success: function (res) {   
        var resData = res.data;
        console.log("数据" , resData);
        console.log("this:",this);
        that.setData({
          listArr: resData.data.reverse()
        })
      }
    })
  },
  to(e){
    console.log(e);
    wx.navigateTo({
      url: '/pages/schoolxq/schoolxq?circleid='+e.currentTarget.dataset.circleid,
    })
  },
  addlike(e){
    console.log(e);
     var that = this;
     wx.request({
       url: 'https://www.woodymidnight.cn/BCUHelper/api/circle/updatacirclelike',
       method: 'POST',
       data:{
         circleId : e.currentTarget.dataset.circleid
       },
       header: { 'content-type': 'application/x-www-form-urlencoded' },
       success: res => {
        // var resData = res.data;
        //  that.setData({
        //    listArr: resData.data
        //  })
        this.chaxun()
       }
     })
  },
})
